//author:jxx
//此处是对表单的方法，组件，权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
import FproductForm from "@/views/Food/proForm.vue";
let extension = {
  components: {//动态扩充组件或组件路径
    //表单header、content、footer对应位置扩充的组件
    gridHeader: '',//{ template: "<div>扩展组xx件</div>" },
    gridBody: FproductForm,
    gridFooter: '',
    //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
    modelHeader: '',
    modelBody: '',
    modelFooter: ''
  },
  buttons: {
    view: [
      {
        name: "编辑",
        icon: 'md-create',
        value: 'update',
        class: '',
        type: 'success',
        index: 1,//显示的位置
        onClick: function () {
          if (
            this.getSelectRows().length > 1 ||
            this.getSelectRows().length == 0 ||
            this.getSelectRows() == undefined
          ) {
            this.$Message.error("只能选中一行进行编辑");
            return false;
          } else {
            let v = this.getSelectRows()[0];
            this.$refs.gridBody.getLIST(v)
          }
        }
      }
    ], box: [], detail: []
  },//扩展的按钮
  methods: {//事件扩展
    onInit () {
      this.$store.getters.data().viewPageTest = this;
    },   //同步泰能菜品
    AddDownloadFood () {
      this.$confirm("确定同步菜品吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        customClass: "del-model",
        type: "warning"
      })
        .then(() => {
          this.http
            .get("/api/Fproduct/AddDownloadFood", "")
            .then(result => {
              this.refresh()
            });
        });


    }, //点击选中
    rowClick ({ row, column, event }) {
      this.$refs.table.$refs.table.toggleRowSelection(row);
      return true
    },

  }
};
export default extension;
